<?php

/**
 * HistoriaClinica form base class.
 *
 * @package    form
 * @subpackage historia_clinica
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseHistoriaClinicaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'paciente_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Paciente', 'add_empty' => false)),
      'hospital_id'   => new sfWidgetFormDoctrineChoice(array('model' => 'Hospital', 'add_empty' => false)),
      'codigo'        => new sfWidgetFormInput(),
      'observaciones' => new sfWidgetFormTextarea(),
      'estado'        => new sfWidgetFormInput(),
      'slug'          => new sfWidgetFormInput(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorDoctrineChoice(array('model' => 'HistoriaClinica', 'column' => 'id', 'required' => false)),
      'paciente_id'   => new sfValidatorDoctrineChoice(array('model' => 'Paciente')),
      'hospital_id'   => new sfValidatorDoctrineChoice(array('model' => 'Hospital')),
      'codigo'        => new sfValidatorString(array('max_length' => 10)),
      'observaciones' => new sfValidatorString(array('max_length' => 2147483647, 'required' => false)),
      'estado'        => new sfValidatorString(array('max_length' => 1)),
      'slug'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'created_at'    => new sfValidatorDateTime(array('required' => false)),
      'updated_at'    => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'HistoriaClinica', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('historia_clinica[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'HistoriaClinica';
  }

}
